<?
        require_once '../inc/functions.php';
        require_once 'data.php';
        $section='Users';
        $result = Users::GetAll();
?>

<!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="../inc/site.css" />
        <title>Users</title>
        <style type="text/css">
                        .new-row { background: #CC0; }
                </style>
                 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js">
                </script>
        <script type="text/javascript">
                $(document).ready(function(){
                        $.get("edit.php?IsAjax=1", function(data){
                                $("#insert").html(data.html);
                        },"json");
                        $(".AjaxLink").bind('click', LoadForm);
                        $("form").live('submit', function(){
                                var f = this;
                                var formVars = $(this).serialize();
                                $.post(this.action, formVars, function(data){
                                        if(data.message == "Error")
                                        {
                                                $(f).replaceWith(data.html);
                                                $("#msgbox").html(data.errors);
                                        }
                                        else
                                        {
                                                var tr = $(f).closest("tr");
                                                tr.replaceWith(data.html);
                                                tr.find(".AjaxLink").bind('click', LoadForm);
                                        }
                                },"json");
                                return false;
                        })
                });
                function LoadForm(){
                                var a = this;
                                $.get(this.href, {IsAjax:true}, function(data){
                                        var tr = $(a).closest("tr");
                                        tr.find("td").hide();
                                        var temp = $("<td colspan='6' />").appendTo(tr);
                                        temp.html(data.html);
                                        //$("#insert").html(data);
                                        temp.find(".cancel").click(function(){
                                                temp.remove();
                                                tr.find("td").show();
                                        })
                                },"json");
                                return false;
                        }
                </script>
    </head>
   
    <body>
    <div id="container">
       	<div id="logo"><img src="../logo.png" alt="Logo" height="117" width="619" /></div> 
        <div id="nav"> 
		<ul>
			<li><a href="../home.php">Home</a></li>
			<li><a href="../products.php">Products</a></li>
			<li><a href="../Users/index.php">Users</a></li>
			<li><a href="../contact.php">Contact Us</a></li>
		</ul>
		</div>
        <div id="content">
		<a href="http://www.webdevfoundations.net/scripts/cart.asp?view=yes"><img class="floatright" src="../view.jpg" alt="Shopping Cart" width="98px" 
        	height="28px" /></a>
        <h2>Users</h2>
        <div class="error" id="msgbox"></div>
        <a href="edit.php">Create New Account</a>
        <table>
                <tr>
                <th>FirstName</th>
                <th>LastName</th>
                <th>PictureURL</th>
                <th>FBID</th>
                <th>Lookup_id</th>
            </tr>
                        <? while($rs = $result->fetch_assoc()){ ?>
                <? include 'index_details.php'; ?>
            <? } ?>
        </table>
        </div>
        <div id="footer"><i>Copyright &copy; 2011 E-commerce site</i><br />
<a href="mailto:npratt3284@gmail.com">npratt3284@gmail.com</a></div>
       
    </body>
</html>

<? //$conn->close(); ?>